#include <stdio.h>
#include <string.h>

char* split(char** stringp, const char* delim) {
    if (*stringp == NULL) {
        return NULL;
    }
    
    char* start = *stringp;
    char* end = start;
    
    while (*end != '\0') {
        const char* sep = delim;
        
        while (*sep != '\0') {
            if (*end == *sep) {
                *end = '\0';
                *stringp = end + 1;
                return start;
            }
            sep++;
        }
        
        end++;
    }
    
    *stringp = NULL;
    return start;
}


int main() {
    char str[] = "Hello,;world,;How are you?,;=";

    char *strp = str;
    char* token = NULL;
    
    while ((token = split(&strp, ",;")) != NULL) {
        printf("%s (%d)\n", token, strlen(token));
    }
    
    return 0;
}

